package demo517;

import demo516.Emp;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

    public class TestSet {
        public static void main(String[] args) {
            Emp emp1 = new Emp("1001", "小乔", 18);
            Emp emp2 = new Emp("1002", "大乔", 18);
            Set<Emp> set = new HashSet<>();
            set.add(emp1);
            set.add(emp2);

            for (Emp emp : set) {
                System.out.println(emp);
            }
            Scanner scanner = new Scanner(System.in);
            String ename = scanner.next();

            for (Emp emp : set) {
                if (ename.equals(emp.getName())) {
                    System.out.println(emp);
                }
            }

        }
    }

